<template>
   <el-card class="class-card">
    <div class="card-header">
      报名班级
    </div>
    <el-table :data="classData.data" style="width: 100%">
      <el-table-column prop="name" label="培训班级名称"></el-table-column>
      <el-table-column prop="teacherName" label="培训师名称"></el-table-column>
      <el-table-column prop="createTime" label="创建时间"></el-table-column>
    </el-table>
  </el-card>

  
</template>

<script>
import { reactive, ref } from 'vue';
import API from '@/api/personalInformation'
export default {
  setup() {
    const classData = reactive({data:[]})
    let token = localStorage.getItem('token')
    let gTRparams = reactive({
      pageNumer:1,
      pageSize:100,
      offset:0,
      orderName : "",
      orderBy : ""
    })
    function getAllTrainClass(){
      API.getTrainClass(gTRparams,token).then(res=>{
        if (res.data.code === '0'){
          classData.data = res.data.content.records
          for(let i = 0;i<res.data.content.records.length;i++){
          classData.data[i].createTime=classData.data[i].createTime.slice(0,16)
          console.log(classData.data)
          }
        }
      }).catch(error=>{
      console.log(error)
      })
    }
    return {
      classData,
      gTRparams,
      getAllTrainClass
      };
    },
    mounted() {
      this.getAllTrainClass()
    }
}
</script>

<style scoped>
  .card-header {
    font-weight: bold;
    padding: 10px;
    background-color: #f5f7fa;
    border-bottom: 1px solid #ebeef5;
  }

</style>